<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>爸爸的爸爸叫爷爷</title>
    <script src="./res/jquery-3.5.1.min.js"></script>
    <style>
        .box {
            display: block;
            border: 2px solid #abcdef;
            color: #331258;
            padding: 5px;
            margin: 15px;
        }
    </style>
</head>

<body>
    <div class="box">
        box
        <div style="width: 500px;">
            div
            <ul>
                ul
                <li>
                    li
                    <sapn>span</sapn>
                </li>
            </ul>
        </div>
    </div>
</body>

</html>
<script>
    $(function(e) {
        $('sapn').parents().css({
            'color': '#F00',
            'border': '3px solid #F00'
        });
    });
</script>